package be.ipl.pigolo.testUcc;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.junit.Before;
import org.junit.Test;

import be.ipl.pigolo.domaine.Fermier;
import be.ipl.pigolo.usecases.GestionPartie;

public class TestInscription {

	private static GestionPartie gp;
	
	@Before
	public void setUp() throws Exception {
		try {
			Context jndi = new InitialContext();
			gp = (GestionPartie) jndi
					.lookup("ejb:PigoloEAR/PigoloEJB/GestionPartieImpl!be.ipl.pigolo.usecases.GestionPartie");
			assertNotNull(gp);
		} catch (NamingException e) {
			e.printStackTrace();
		}
		
	}
	
	@Test
	public void testInscriptionNomNull(){
		assertFalse(this.gp.inscrire("", "azerty"));
	}
	
	@Test
	public void testInscriptionNomMdpNull(){
		assertFalse(this.gp.inscrire("", ""));
	}
	
	@Test
	public void testInscriptionMdpNull(){
		assertFalse(this.gp.inscrire("kif", ""));
	}
	
	@Test
	public void testInscriptionValide(){
		assertTrue(gp.inscrire("joueur4","azerty"));
	}

}
